import { createReducer } from '../../../util'
import types from '../../types'
import InitState from './authInitState'

export default createReducer(new InitState, {
  [`${types.SIGN_IN}_SUCCESS`]: (state, msg) => {
    return state.set('message', msg);
  },
  [`${types.SIGN_FAIL}_SUCCESS`]: (state, failMsg) => {
    return state.set('message', failMsg);
  },
  [`${types.SIGN_OUT}_SUCCESS`]: (state, data) => {
    return state.set('authenticated', false).set('id',null);
  }
})
